package com.xh.bussiness.teachbook.service;

import com.alibaba.fastjson.JSONObject;
import com.xh.bussiness.teachbook.bean.dto.NowTeachingBookStudentResultDto;
import com.xh.bussiness.teachbook.bean.dto.TeachingBookDto;
import com.xh.bussiness.teachbook.bean.request.BindPaike2TeachingBookRequest;
import com.xh.bussiness.teachbook.bean.request.QueryAuditTeachingBookRequest;
import com.xh.bussiness.teachbook.bean.request.QueryTeachingBookRequest;
import com.xh.bussiness.teachbook.bean.request.TeachingBookRequest;
import com.xh.bussiness.teachbook.model.TeachingBook;
import com.xh.core.bean.XhPage;
import com.xh.core.service.IBaseService;

import javax.servlet.http.HttpServletRequest;
import java.util.List;
import java.util.Map;

public interface ITeachingBookService extends IBaseService<TeachingBook> {


    TeachingBookDto getTeachingBookById(String id);

    /**
     * 分页查询教案
     *
     * @param request
     * @return
     */
    XhPage queryTeachingBookPage(XhPage page, QueryTeachingBookRequest request);


    /**
     * 新增教案
     *
     * @param bean
     * @return
     */
    String addTeachingBook(TeachingBookRequest bean);

    /**
     * 上传文件类型教案
     * @param bean
     * @param request
     * @return
     */
    String addTeachingBookByFile(TeachingBookRequest bean, HttpServletRequest request);

    String bindPaike2TeachingBook(BindPaike2TeachingBookRequest request);


    /**
     * 修改教案
     *
     * @param bean
     * @return
     */
    String modifyTeachingBook(TeachingBookRequest bean);


    /**
     * 删除教案
     *
     * @param id
     * @return
     */
    String deleteTeachingBook(String id);


    /**
     * 查询待我审批的教案
     *
     * @param status
     * @return
     */
    List<TeachingBook> queryToAudit(Integer status);


    /**
     * 查询已发布的教案
     *
     * @return
     */
    List<TeachingBook> queryPublisded(Integer status);


    /**
     * 审核教案
     *
     * @param id
     * @param status
     * @return
     */
    TeachingBook auditTeachingBook(String id, Integer status, String remark, JSONObject currentUser);


    /**
     * 发布与取消教案
     *
     * @param id
     * @param status
     * @return
     */
    String publishTeachingBook(String id, Integer status);


    /**
     * 根据id查询教案内容
     *
     * @param id
     * @return
     */
    JSONObject queryById(String id);

    /**
     * 查询老师给学生备课次数
     *
     * @param teacherId
     * @param refId
     * @param contractId
     * @return
     */
    Integer queryTeachingBookCount(String teacherId, Integer refId, Integer contractId);

    /**
     * 根据l龙文排课ID查询备课信息
     *
     * @param paikeId
     * @return
     */
    TeachingBook queryByPaikeId(String paikeId);

    /**
     * 通过龙文排课id查询备课信息
     *
     * @param lwPaikeId
     * @return
     */
    TeachingBookDto queryTeachingBookInfoByPaikeId(String lwPaikeId);

    Integer queryCountByRefId(String refId, Integer classType);

    NowTeachingBookStudentResultDto queryNowTeachingBookStudentResult(String teachingBookId, String studentId);


    Map<String,Object> chooseQuestionToCache(String uniqueKey, Integer type, String questionId);

    Map<String,Object> queryTeachingBookQuestionCacheByKey(String uniqueKey,Integer type);

    void removeTeachingBookQuestionCache(String uniqueKey,Integer type);

    /**
     * 查询已审核通过的教案
     * @param teacherId
     * @return
     */
    List<TeachingBook> queryAcceptTeachingBookByTeacherId(String teacherId,String refId);
}
